import { defineStore } from 'pinia';

export const useShopStore = defineStore('shop', {
	state: () => {
		return {
			// 加入购物车动画的坐标
			animation: {
				start: { // 开始坐标
					top: null,
					left: null,
				},
				end: { // 结束坐标
					top: 0,
					left: 0,
				}
			},
			isShowComboPanel: false,
		}
	},

	getters: {

	},

	actions: {
		// 重置store
		RESET_STORE() {
			this.$reset();
		},
		
		// 设置加入购物车动画的开始坐标
		SET_ANIMATION_START_POINT(top, left) {
			this.animation.start.top = top;
			this.animation.start.left = left;
		},
		
		// 设置加入购物车动画的结束坐标
		SET_ANIMATION_END_POINT(top, left) {
			this.animation.end.top = top;
			this.animation.end.left = left;
		},

		// 显示规格面板
		SHOW_COMBO_PANEL() {
			this.isShowComboPanel = true;
		},

		// 隐藏规格面板
		HIDE_COMBO_PANEL() {
			this.isShowComboPanel = false;
		},
	},
})